package com.hdu.point_offer;

public class lcr161 {
    class Solution {
        public int maxSales(int[] sales) {
            int sum = Integer.MIN_VALUE;
            int presum = Integer.MIN_VALUE;
            for (int i = 0; i < sales.length; i++)
            {
                if (presum < 0)
                {
                    presum = sales[i];
                }
                else
                {
                    presum += sales[i];
                }
                sum = Math.max(sum, presum);
            }
            return sum;
        }
    }
}
